package com.kata.chapter9;

/**
 * Created by Solidsnake on 2014/11/26.
 */
public class AdapterElectricity implements Electricity {

    private Electricity target;

    public AdapterElectricity(Electricity target) {
        System.out.println("启用电流适配器");
        this.target = target;
    }

    @Override
    public int docking() {
        int docking = target.docking();
        if(docking != 3) {
            System.out.println("套结三向插头装置");
            docking = 3;
        }
        return docking;
    }

    @Override
    public int currentVoltage() {
        return target.currentVoltage();
    }

    @Override
    public int request() {
        int request = target.request();
        if(request != 220) {
            System.out.println("电压不为220V, 使用稳压装置转换电压");
            request = 220;
        }
        return request;
    }

    private boolean isNeedCase() {
        return this.target instanceof USAElectricity;
    }
}
